package com.banch.cloud.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class GateWayConfig {

    /**
     * 编码的方式配置路由
     *
     * @param
     * @return
     * @author banch
     * @date 2020/7/22
     * @throw
     **/
    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_rote_baidu", r -> r.path("/guonei").uri("http://news.baidu.com/"));
        return routes.build();
    }
}